package com.skt.exception;

import lombok.Getter;

@Getter
public class BaseException extends RuntimeException {
    private final int code;
    private final String message;
    
    public BaseException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }
    
    public BaseException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
    }
    
    public BaseException(ErrorCode errorCode, String customMessage) {
        super(customMessage);
        this.code = errorCode.getCode();
        this.message = customMessage;
    }
    
    // ========== 静态工厂方法 ==========
    public static BaseException of(ErrorCode errorCode) {
        return new BaseException(errorCode);
    }
    
    public static BaseException of(ErrorCode errorCode, String customMessage) {
        return new BaseException(errorCode, customMessage);
    }
    
    public static BaseException of(int code, String message) {
        return new BaseException(code, message);
    }

}